package com.bzg.transaction.config;

import org.springframework.context.annotation.*;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.TransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.interceptor.TransactionAttributeSource;

import javax.sql.DataSource;

@Configuration
@EnableAspectJAutoProxy(exposeProxy = true)
@ImportResource("classpath:spring.xml")
@ComponentScan(basePackages = {"com.bzg.transaction"})
@EnableTransactionManagement
public class AppConfig {

    @Bean
	public TransactionManager transactionManager(DataSource dataSource) {
		DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager();
		dataSourceTransactionManager.setDataSource(dataSource);
		return dataSourceTransactionManager;
	}
}
